package com.chinasofti.io;

import java.io.*;

public class Demo10 {
    public static void main(String[] args) throws IOException {
        BufferedWriter bw =
                new BufferedWriter(new FileWriter("java419\\bw.txt"));
        bw.write("hello\r\n");
        bw.write("world\r\n");
        bw.close();

        BufferedReader br =
                new BufferedReader(new FileReader("java419\\bw.txt"));
        //一次读一个字符
//        int ch;
//        while((ch = br.read()) != -1){
//            System.out.print((char)ch);
//        }
        //一次读一个字符数组
        char[] chs = new char[1024];
        int len;
        while((len = br.read(chs)) != -1){
            System.out.print(new String(chs,0,len));
        }

        br.close();

    }
}